Conversation
…Ollama) Add external AI provider support for file classification: - OpenAI (GPT-4o-mini by default) - Anthropic Claude (claude-3-haiku by default) - Google Gemini (gemini-1.5-flash by default) - Ollama (local LLMs via ollama server) - Local MobileBERT (existing offline classifier) New CLI commands: - `sortora ai list` - list available providers - `sortora ai set <provider>` - set active provider - `sortora ai test` - test current provider - `sortora ai info` - show configuration Configuration via environment variables or config file. Usage: `sortora scan ~/Downloads --ai --provider openai` Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for multiple external AI providers for file classification, extending beyond the existing local MobileBERT model. Users can now choose from various AI backends based on their preferences and requirements.
Supported Providers
Changes Made
New Files
src/ai/providers/types.ts- Provider interface and shared typessrc/ai/providers/openai.ts- OpenAI provider implementationsrc/ai/providers/anthropic.ts- Anthropic Claude provider implementationsrc/ai/providers/gemini.ts- Google Gemini provider implementationsrc/ai/providers/ollama.ts- Ollama (local LLM) provider implementationsrc/ai/providers/local.ts- Wrapper for existing MobileBERT classifiersrc/ai/providers/index.ts- Provider factory and managerModified Files
src/config.ts- Added AI provider configuration schema with env variable supportsrc/core/analyzer.ts- Integrated provider system into file analysissrc/cli.ts- Added newaicommand for provider managementsrc/index.ts- Exported new provider types and classesNew CLI Commands
Configuration
Environment Variables
Config File (~/.config/sortora/config.yaml)
Implementation Details
AIProviderinterface for consistent behaviorTest Plan
sortora ai listcommandsortora ai infocommandsortora ai set <provider>for each providersortora ai testwith configured providersortora scan --ai --provider <provider>for classificationThis PR was written using Vibe Kanban